//单例 饿汉模式
//唯一实例创建非常早，类似于饿了很久的人，看到吃的就赶紧开吃。（急迫）
class Singleton{
    private static Singleton instance = new Singleton();

    public static Singleton getInstance(){
        return instance;
    }

    private Singleton(){}
}
public class Demo27 {
    public static void main(String[] args) {
        Singleton s1 = Singleton.getInstance();
        Singleton s2 = Singleton.getInstance();

        System.out.println(s1 == s2);

        //Singleton s3 = new Singleton();
    }
}
